import {Service} from "adajs";

class QuestionService extends Service {
    defaultData() {
        return {
            defaultData() {
                return {
                    isLoad: false,
                    newsInfo: {
                        "wjmc": "测试",
                        "kssj": "2018-12-11 00:00:00",
                        "jssj": "2018-12-19 00:00:00",
                        "crtUser": "admin",
                        "crtTime": "2018-12-19 16:48:13",
                        "crtIp": "127.0.0.1",
                        "subjectInfo": [],
                    },
                    id: ""
                }
            }
        }
    }

    onupdate(current, id) {
        if (id) {
            return this.context.request.post("/api/lgb/app/lgb/questionnaire/get", {id}).then(({data}) => {
                current.id = id;
                current.isLoad = true;
                current.newsInfo = data;
            });
        }
    }
}

export default QuestionService;